<?php

namespace App\Http\Middleware\Admin;
use Closure;
use App\Http\Controllers\Admin\LoginController;
class AutoLogout
{
    public function handle($request, Closure $next)
    {
		if(session('last_access') < (time()-30*60)){
			$loginCtrl = new LoginController;
			$loginCtrl->logout();
		}else{
			session(["last_access" => time()]);
		}
        return $next($request);
    }
}
